package com.hzbank.juc.introduction;

import lombok.extern.slf4j.Slf4j;

import static java.lang.Thread.sleep;

/**
 * @description:
 * @author: libugu@cskaoyan.com
 * @date 2023/12/18 - 16:08
 */
@Slf4j
public class Join {
    static  int i = 0;
    public static void main(String[] args) throws InterruptedException {
        test1();
    }
    private static void test1() throws InterruptedException {
        log.debug("test1开始");
        Thread thread = new Thread(
                ()->{
                    log.debug("thread开始");
                    try {
                        sleep(1000);
                    } catch (InterruptedException e) {
                        throw new RuntimeException(e);
                    }
                    i  = 10;
                },"t1"
        );
        thread.start();
        thread.join();
        log.debug("结果为{}",i);
        log.debug("结束");
    }
}
